<?php


namespace App\Http\Controllers\admin\api;


use App\Http\Controllers\admin\service\StatisticsService;
use App\Http\Controllers\admin\validate\Statistics;
use App\Http\Controllers\utils\ToolUtil;
use Illuminate\Http\Request;

class StatisticsApi
{
    public static function querySumSn(Request $request){
        $param = $request->all();
        $data = Statistics::querySumSn($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return StatisticsService::querySumSn($param);
    }

    public static function appUploadStatistics(Request $request){
        $param = $request->all();
        $data = Statistics::appUploadStatistics($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return StatisticsService::appUploadStatistics($param);
    }

    public function queryAppOnlineTime(Request $request){
        $param = $request->all();
        $data = Statistics::queryAppOnlineTime($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return StatisticsService::queryAppOnlineTime($param);
    }

    public function statisticsUser(){
        return StatisticsService::statisticsUser();
    }

    public function registerUser(){
        return StatisticsService::registerUser();
    }

    public function webVisitUser(){
        return StatisticsService::webVisitUser();
    }

    public function statisticsFlow(Request $request){
        $param = $request->all();
        $data = Statistics::statisticsFlow($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return StatisticsService::statisticsFlow($param);
    }

    public function queryStatistics(Request $request){
        $param = $request->all();
        $data = Statistics::queryStatistics($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return StatisticsService::queryStatistics($param);
    }

    public function queryIdStatistics(Request $request){
        $param = $request->all();
        $data = Statistics::queryIdStatistics($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return StatisticsService::queryIdStatistics($param);
    }

    public function editStatistics(Request $request){
        $param = $request->all();
        $data = Statistics::editStatistics($param);
        if($data){
            return ToolUtil::returnJson(401,$data[0]);
        }
        return StatisticsService::editStatistics($param);
    }
}